<div class="committee search">
    <?php
        if(isset($cursearch1)||isset($cursearch2)||isset($cursearch3)||isset($cursearch)||isset($cursearch0)){
            echo ' [ '.$html->link(__("View Report",true),array('committee'=>$dcommittee['Committee']['short_name'],'controller'=>'reports','action'=>'status'),array('target'=>'_blank')).' ] ';
        }
    ?>
    <h2><?php  __('Search committee');?>: <?php echo $dcommittee['Committee']['name'];?></h2>
    
    <?php echo $this->element('searchbox',array('from'=>$this->params['controller'].'/'.$this->params['action'])); ?>
    
    <p>&nbsp;</p>
    <h4><?php echo __('Individual Implementors');?></h4>

    <table cellpadding="0" cellspacing="0">
        <tr>
            <th width="2%"><?php __('No')?></th>
            <th width="15%"><?php __('Meeting');?></th>
            <th width="15%"><?php __('Project/Item');?></th>
            <th width="30%"><?php __('Decision');?></th>
            <th width="20%"><?php __('Implementors & Status');?></th>
        </tr>
        <?php if(!isset($results) || !count($results)):?>
        <tr>
            <td colspan="5"><?php __('No records found')?></td>
        </tr>
        <?php else: ?>
        <?php
        $i = 0;
        foreach ($results as $result):
            $class = null;
        if ($i++ % 2 == 0) {
            $class = ' class="altrow"';
        }
        ?>
            <tr<?php echo $class;?>>
                <td><?php echo $i.'. ' ?></td>
                <td><?php echo $result['Meeting']['meeting_title'].' '.$result['Meeting']['meeting_num']; ?></td>
                <td><?php 
                    echo $result['Item']['name'].'<br/>'; 
                 ?>
                </td>
                <td>
                    <?php echo $text->highlight($result['Decision']['description'],$curkey); ?><br/>
                    <?php if(!empty($result['Decision']['deadline'])){ ?>
						<?php __('Action Deadline')?>: 
						<strong><?php echo date(Configure::read('date_format'),strtotime($result['Decision']['deadline']))?></strong><br/>
                    <?php } ?>
                </td>
                <td>
                    <?php 
                    if(isset($result['User']['name'])){
                        echo isset($result['Title']['short_name']) ? $result['Title']['short_name'].' ' : '';
                        echo $result['User']['name'];echo "<br>";
                        echo isset($result['UserStatus']['description']) ? $text->highlight($result['UserStatus']['description'],$curkey):__('No status',true);
                        echo "<br/>";
                        echo isset($result['UserStatus']['description'])? __('Action date',true).': <strong>'.date(Configure::read('date_format'),strtotime($result['UserStatus']['action_date'])).'</strong>':'';
                        
                    }
                    echo "<p>&nbsp;</p>";
                    echo $html->link(__('See details',true),array('controller'=>'decisions','action'=>'view','id'=>$result['Decision']['id'],'committee'=>$dcommittee['Committee']['short_name']));
                    ?>
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif;?>
    </table>

    <p>&nbsp;</p>
    <h4><?php echo __('Group Implementors');?></h4>

    <table cellpadding="0" cellspacing="0">
    <tr>
        <th width="2%"><?php __('No')?></th>
        <th width="15%"><?php __('Meeting');?></th>
        <th width="15%"><?php __('Project/Item');?></th>
        <th width="30%"><?php __('Decision');?></th>
        <th width="20%"><?php __('Implementors & Status');?></th>
    </tr>

    <?php if(!isset($results_grp) || !count($results_grp)):?>
    <tr>
        <td colspan="5"><?php __('No records found')?></td>
    </tr>
    <?php else: ?>
    <?php
        $i = 0;
        foreach ($results_grp as $result):
            $class = null;
        if ($i++ % 2 == 0) {
            $class = ' class="altrow"';
    }
    ?>
    <tr<?php echo $class;?>>
        <td><?php echo $i.'. ' ?></td>
        <td><?php echo $result['Meeting']['meeting_title'].' '.$result['Meeting']['meeting_num']; ?></td>
        <td><?php echo $result['Item']['name'].'<br/>';  ?></td>
        <td>
			<?php echo $text->highlight($result['Decision']['description'],$curkey); ?><br/>
            <?php if(!empty($result['Decision']['status_deadline'])){ ?>
				<?php __('Action Deadline')?>:
				<strong><?php echo date(Configure::read('date_format'),strtotime($result['Decision']['status_deadline']))?></strong>
			<?php } ?>
		</td>
        <td>
            <?php 
            if(isset($result['Group']['name'])){
                echo $result['Group']['name'];
                echo isset($result['GroupStatus']['description'])? ' - '.__('Action date',true).': <strong>'.date(Configure::read('date_format'),strtotime($result['GroupStatus']['action_date'])).'</strong>':'';
                echo "<br>";
                echo isset($result['GroupStatus']['description']) ? $text->highlight($result['GroupStatus']['description'],$curkey):__('No status',true);
                echo "<br>";
                
            }
            echo "<p>&nbsp;</p>";
            echo $html->link(__('See details',true),array('controller'=>'decisions','action'=>'view','id'=>$result['Decision']['id'],'committee'=>$dcommittee['Committee']['short_name']));
            ?>
            
        </td>
    </tr>
    <?php endforeach; ?>
    <?php endif;?>
    </table>
</div>

